Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] [Performance] Approximate the ideal number of reports to render on first render #4371

Merged
merged 3 commits into from
Aug 3, 2021
Merged

[No QA] [Performance] Approximate the ideal number of reports to render on first render #4371

merged 3 commits into from
Aug 3, 2021

Conversation

rdjuric
Copy link
Contributor

@rdjuric rdjuric commented Aug 2, 2021

Details

Calculated the ideal number of reports to render in the first render based on the screen height and the minimum height of a report

Fixed Issues

$ #4258

Tests

Platform initialNumToRender Average time to switch reports
Android (Release) Fixed (20) 1,899 ms
Android (Release) Ideal (10) 1,236 ms
Web - Chrome (Dev) Fixed (20) 3,795.2 ms
Web - Chrome (Dev) Ideal (7) 1,336.2 ms
iOS - iPhone SE (Dev) Fixed (20) 7016 ms
iOS - iPhone SE (Dev) Ideal (10) 3,888.6 ms

QA Steps

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

web.mov

Mobile Web

mweb.mp4

Desktop

desktop.mov

iOS

ios.mp4

Android

Android.mp4

@rdjuric rdjuric changed the title Approximate the ideal number of reports to render on first render [Performance] Approximate the ideal number of reports to render on first render Aug 2, 2021
@rdjuric rdjuric marked this pull request as ready for review August 2, 2021 18:51
@rdjuric rdjuric requested a review from a team as a code owner August 2, 2021 18:51
@MelvinBot MelvinBot requested review from TomatoToaster and removed request for a team August 2, 2021 18:51
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just had a few comments.

<BaseInvertedFlatList
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={ref}
initialNumToRender={20}
initialNumToRender={props.initialNumToRender}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we can just remove this since each platform version is getting the prop passed via ...props same for the android, web, versions.

I'm not sure it should be a required prop as we can still fallback to the default value in cases where we are not getting more specific. Other things may use the inverted FlatList without this optimization.

Copy link
Contributor Author

@rdjuric rdjuric Aug 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️ Thanks for the catch! This really is unnecessary. Changed the code for all platforms.

Comment on lines 263 to 264
* Calculates the ideal number of reports to render in the first render, based on the screen height and on
* the height of the smallest report possible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Calculates the ideal number of reports to render in the first render, based on the screen height and on
* the height of the smallest report possible.
* Calculates the ideal number of report actions to render in the first render, based on the screen height and on
* the height of the smallest report action possible.

* @return {Number}
*/
calculateInitialNumToRender() {
const smallestReport = styles.chatItem.paddingTop + styles.chatItem.paddingBottom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name minimumReportActionHeight ?

// Remove clipped subviews helps prevent avatars and attachments from eating up excess memory on Android. When
// we run out of memory images stop appearing without any warning.
// eslint-disable-next-line react/jsx-props-no-multi-spaces
shouldRemoveClippedSubviews
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want this here. Just removing the initialNumToRender={20}. IIRC removing the clipped sub views has unexpected effects on iOS (which is why there are separate files for iOS and Android).

<BaseInvertedFlatList
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={ref}
initialNumToRender={20}
initialNumToRender={props.initialNumToRender}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can revert all these changes in this file I think?

@marcaaron
Copy link
Contributor

Sorry @rdjuric just dawned on me that you maybe were not ready for another review 😓

@rdjuric rdjuric requested a review from marcaaron August 2, 2021 23:54
@rdjuric
Copy link
Contributor Author

rdjuric commented Aug 2, 2021

No worries @marcaaron, I had forgot about Android 🥲 Should be ready for review now!

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working great for me thanks!

@marcaaron marcaaron merged commit 553e9b8 into Expensify:main Aug 3, 2021
@OSBotify
Copy link
Contributor

OSBotify commented Aug 3, 2021

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

OSBotify commented Aug 6, 2021

🚀 Deployed to staging in version: 1.0.82-8🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@isagoico
Copy link

isagoico commented Aug 6, 2021

@rdjuric Hello! Any QA tests needed for this one?

@marcaaron
Copy link
Contributor

I don't think there are any specific steps besides regressions around navigating to a chat

@marcaaron marcaaron changed the title [Performance] Approximate the ideal number of reports to render on first render [No QA] [Performance] Approximate the ideal number of reports to render on first render Aug 6, 2021
@OSBotify
Copy link
Contributor

🚀 Deployed to production by @francoisl in version: 1.0.83-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 failure ❌
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants